{% extends 'IcsocUIBundle::page.html.twig' %}
{% from 'IcsocUIBundle:Macro:formValidator.html.twig' import jqvalidator %}
{% block stylesheet %}
    {{ parent() }}
    {% stylesheets
    '@gritter_css'
    filter='cssrewrite' filter='uglifycss'
    %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

{% block content %}

    <div class="col-xs-12 col-sm-12 widget-container-col ui-sortable">
        <!-- #section:custom/widget-box -->
        <div class="widget-box">
            <div class="widget-header">
                <h5 class="widget-title">{{ 'The matters needing attention'|trans }}</h5>
                <!-- #section:custom/widget-box.toolbar -->
                <div class="widget-toolbar">
                    <a href="#" data-action="collapse">
                        <i class="ace-icon fa fa-chevron-up"></i>
                    </a>
                </div>
                <!-- /section:custom/widget-box.toolbar -->
            </div>

            <div class="widget-body">
                <div class="widget-main">
                   <div class="row">
                       <ul>
                           <li>1: {{ 'Skill name, skill number cannot be empty, and skill number fill in the numbers only'|trans }}</li>
                           <li>2: {{ 'Skill type can only fill 0、1、2, do not fill the default is 1 (0 incoming and outgoing, 1 incoming,2 outgoing)'|trans }}</li>
                           <li>3: {{ 'The queue length, the ringing duration, post processing time unit is seconds, do not fill the default values were 120, 30, 5'|trans }}</li>
                           <li>4: {{ 'Whether the reported number, whether to broadcast Y, N can only fill in (Y-yes, N-no), do not fill the default is no'|trans }}</li>
                           <li>5: {{ 'The level of skill set out priorities can only be filled with positive integer, do not fill the default is 0'|trans }}</li>
                           <li>6: {{ 'Whether static login fill can fill in Y, N, the column fill behind must have a seating information (a seat at table information including extension, skill level, the role of three seats, each seat with a corresponding, add the three column, and three columns are required)'|trans }}</li>
                           <li>7: {{ 'At group level can only be filled with positive integer skills'|trans }}</li>
                           <li>8: {{ 'According to the need to fill seats role, if the import role in the system will not automatically creates'|trans }}</li>
                           <li>9:{{ 'Do not fill the following static login, information agents ignore default'|trans }}</li>
                           <li>10:{{ 'At the extension number can fill in the phone number, No. 400, No. 800, No. 1010, telephone (fixed must fill in the code, area code and telephone can be separated by any other symbol)'|trans }}</li>
                       </ul>
                   </div>
                </div>
            </div>
        </div>

        <div class="widget-box">
            <div class="widget-header">
                <h5 class="widget-title">{{ 'Batch add skill'|trans }}</h5>
                <!-- #section:custom/widget-box.toolbar -->
                <div class="widget-toolbar">
                </div>
                <!-- /section:custom/widget-box.toolbar -->
            </div>

            <div class="widget-body">
                <div class="widget-main" id="action_lsit">
                    <div class="widget-box">
                        <div class="widget-header widget-header-flat">
                            <h4 class="widget-title">1. {{ 'Download data template'|trans }}</h4>
                        </div>

                        <div class="widget-body">
                            <div class="widget-main">
                                <button class="btn btn-primary" onclick="export_model()">
                                    <i class="ace-icon fa fa-flask align-top bigger-125"></i>
                                    {{ 'Download template'|trans }}
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
                <form action="{{ path('icsoc_queue_upload') }}" method="post"  enctype="multipart/form-data" id="theForm">
                    <div class="widget-main" id="action_lsit">
                        <div class="widget-box">
                            <div class="widget-header widget-header-flat">
                                <h4 class="widget-title">2. {{ 'Select Edit good template file to import data'|trans }}</h4>
                            </div>

                            <div class="widget-body">
                                <div class="widget-main">
                                    <div class="col-xs-8">
                                        <input type="file" id="file_address" name="file_address" />
                                    </div>
                                    <div style="clear: both"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="widget-main" id="action_lsit">
                        <div class="widget-box">
                            <div class="widget-header widget-header-flat">
                                <h4 class="widget-title">3. {{ 'To determine the import'|trans }}</h4>
                            </div>

                            <div class="widget-body">
                                <div class="widget-main">
                                    <button class="btn btn-primary" type="button" onclick="start_upload_data()">
                                        <i class="ace-icon fa fa-cloud-upload bigger-125"></i>
                                        {{ 'Start import'|trans }}
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

{% endblock %}
{% block footer %}
    {% javascripts
    '@jqvalidate_js'
    '@gritter_js'
    '@common_js'
    filter='uglifyjs'
    %}
    <script src="{{ asset_url }}" type="text/javascript"></script>
    {% endjavascripts %}
    <script type="text/javascript">
        $(document).ready(function(){
            $('#file_address').ace_file_input({
                no_file:'{{ 'No File'|trans }} ...',
                btn_choose:'{{ 'Choose'|trans }}',
                btn_change:'{{ 'Re selection'|trans }}',
                onchange:null,
                thumbnail:false
            });
        });

        //导出模板
        function export_model()
        {
            window.location.href="{{ path('icsoc_queue_export') }}";
        }
        /* 开始导出数据 */
        function start_upload_data()
        {
            if(!$("#file_address").val()) {
                gritterAlert('{{ 'Prompt'|trans }}', '{{ 'Please select import data file'|trans }}','error');
                return false;
            } else {
                $("#theForm").submit();
            }
        }
    </script>
{% endblock %}